<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>微信支付</title>
    <!--[if lt IE 9]>  
        <script src="http://cdn.bootcss.com/html5shiv/r29/html5.js"></script>
        <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>    
    <![endif]-->

</head>
<!--<b id="chufa">触发</b>-->
<body>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script>
        var wxLogin='<!--{$wxLogin}-->';
        var jumpUrl='<!--{$jumpUrl}-->';
        var returnUrl='<!--{$returnUrl}-->';
        var mweb_url='<!--{$Think.cookie.mweb_url}-->';
        if(wxLogin==1){
            setTimeout(function(){
                WeixinJSBridge.invoke(
                        'getBrandWCPayRequest', {
                            "appId":"<!--{$appId}-->",     //公众号名称，由商户传入
                            "timeStamp":"<!--{$timeStamp}-->",         //时间戳，自1970年以来的秒数
                            "nonceStr":"<!--{$nonceStr}-->", //随机串
                            "package":"<!--{$package}-->",
                            "signType":"<!--{$signType}-->",         //微信签名方式：
                            "paySign":"<!--{$paySign}-->" //微信签名
                        },
                        function(res){
                            // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
                            if(res.err_msg == "get_brand_wcpay_request:ok" ){
                                location.href=jumpUrl;
                            }else{
                                if(returnUrl){
                                    location.href=returnUrl;
                                }else{
                                    setTimeout(function(){
                                        window.history.go(-1);
                                    },30000);
                                }
                            }
                        }
                );
            },1500);
        }else{
            if(mweb_url){
                location.href=mweb_url;
            }
        }


    </script>
</body>
</html>